﻿-- Creating table 'ProductPricingPerUnitTrackings'
CREATE TABLE [dbo].[ProductPricingPerUnitTrackings] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(50)  NOT NULL,
    [PurchasingPrice] float  NOT NULL,
    [SellingPrice] float  NOT NULL,
    [CreateOn] datetime  NOT NULL,
    [DeleteOn] datetime  NULL,
    [ProductId] int  NOT NULL
);
GO
-- Creating foreign key on [ProductId] in table 'ProductPricingPerUnitTrackings'
ALTER TABLE [dbo].[ProductPricingPerUnitTrackings]
ADD CONSTRAINT [FK_ProductProductPricingPerUnitTracking]
    FOREIGN KEY ([ProductId])
    REFERENCES [dbo].[Products]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO
-- Creating primary key on [Id] in table 'ProductPricingPerUnitTrackings'
ALTER TABLE [dbo].[ProductPricingPerUnitTrackings]
ADD CONSTRAINT [PK_ProductPricingPerUnitTrackings]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO
-- Creating non-clustered index for FOREIGN KEY 'FK_ProductProductPricingPerUnitTracking'
CREATE INDEX [IX_FK_ProductProductPricingPerUnitTracking]
ON [dbo].[ProductPricingPerUnitTrackings]
    ([ProductId]);